﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_Login : System.Web.UI.Page
{
    protected LocalFunctions FUNC;
    protected void Page_Load(object sender, EventArgs e)
    {
        FUNC = new LocalFunctions(true);
        
        lblName.Text = FUNC.GetPhrase(1);
        lblPassword.Text = FUNC.GetPhrase(2);
        btnSend.Text = FUNC.GetPhrase(5);
    }

    protected void btnSend_Click(object sender, EventArgs e)
    {
        Dal.arParams.Clear();
        Dal.arParams.Add(txtName.Text);
        Dal.arParams.Add(txtPassword.Text);
        int? iUserID=Convert.ToInt32(Dal.ExecuteDBspOneValue("Admin_CheckUser", Dal.arParams, true));
        if (iUserID == 0)
        {
            lblError.Text = FUNC.GetPhrase(3);
            lblError.Visible = true;
        }
        else
        {
            Session["userID"] = iUserID;
            //Redirect to default
            Response.Redirect("default.aspx");
        }
    }
}